Where are the files that you have access to through SAS® Studio?

5

Where does SAS Studio store files, and how do you access them? The answer: it depends.

For an illustration, submit the following code in SAS Studio:

%put &sysscpl;
%put &syshostname;
%put &sysvlong;


The values that are returned in your log window show which operating system is being used to run SAS, the name of the server that is running Base SAS®, and the version of SAS that is running on that server.

If you are running the single-user edition of SAS® Studio, then SAS®9 is installed on your Microsoft Windows PC locally and you are running SAS Studio on your own personal machine. With this edition of SAS Studio, you can access files on your system and from any mapped drive that uses the Universal Naming Convention (UNC) standard.

However, if you are running an edition of SAS Studio other than the single-user edition, then the files that you create and the files that you have access to are stored on the server where SAS is running.

The server where SAS is running does not have access to the machine from which you are submitting code via the SAS Studio URL in a web browser. In SAS® Studio 3.x, which runs on SAS®9, the Server Files and Folders pane helps you visualize the locations that are accessible to your user ID on the server.

Use the following macro variable to determine where your Home directory is on the server that is running SAS:

%put &userdir;

Your user ID should have Read and Write access to that directory on the file system. Your SAS administration team should have shared best practices for where to store your files on the server and how you can access those files if needed on your local machine. In general, the quickest way to access a file is to right-click it and select Download File, as shown here:

Accessing files in SAS® Studio on SAS® Viya®

On SAS Viya, the file system might not be available to you. If that is the case, your files must be stored in the SAS Content folder. If you are not familiar with the  SAS Content folder in SAS Viya, it is important to understand that the folder does not exist via a physical path on the file system. When you store files in the SAS Content folder tree, you can use the FILESRVC file access method to access them with code. See the examples in Accessing a File by Name and Folder.

To directly bring a file that is stored in the SAS Content folder tree from SAS Studio to your local machine, open the Explorer pane. Right-click the file that you want to access and select Download file:

This blog contains useful information about making files available to the SAS Content folder:

The following SAS Communities blog posts describe how your SAS administrator can make the file system available for you, depending on your version of SAS Viya:

If the file system has been made available for you, then this macro variable contains your default Home directory:

%put &_USERHOME ;

Your SAS server is displayed in the Explorer pane after the Folder Shortcuts entry. As shown below, a myfile.txt file is stored in the Home directory on the file system. Right-click it and select Download file to download it to your local machine:

In the above example, the SAS server is named “NFS mount” and the Home directory is named “Home.” However, the names will be specific to your environment.

Moving files from your local machine to SAS® Studio

To do the reverse and make files from your local machine available to the SAS server where SAS Studio is running, right-click the desired destination folder in the Explorer pane and select Upload files:

Figure 4

I hope that this information helps demystify where your files are stored when you use SAS Studio!

LEARN MORE | SAS TUTORIALS ON YOUTUBE
Share

About Author

Bari Lawhorn

Sr Principal Technical Support Analyst

Bari Lawhorn is a Senior Principal Technical Support Engineer in the Programming Clients and Interfaces group in Technical Support, where she has provided support for the DATA step and Base procedures for more than 25 years. Bari supports SAS Studio, has specialized in support for the SAS Output Delivery System since its inception and is part of a Technical Support NLS (National Language Support) "virtual team."

5 Comments

  1. Joe,
    There is not a shortcut to do so from SAS Studio. You can choose more than one file from the Explorer pane, and right click to choose download for those multiple files. If you have more than can be easily displayed in the Explorer window, I would suggest discussing with your SAS administrator using an operating system tool to make the transfer of files.

  2. Francisco Su on

    Hi Bari, I have some problems saving the information in SAS Content because all the files (reports with a lot of data) are saving in internally Postgres Database, affecting to the installation server. Would yo recommend that the reports that are generated by the programs should save in File Server and not in Sas Content. If it correct, I will distribute all my files using the SAS Content for jobs and programs, and File Server for saving reports, VA panels or another objects. Please, if you have any recommendation for that. Thank you very much.

  3. Julien Heijster on

    Thanks Bari for the shared insight. Any thoughts on sizing and performance recommendations when storing and retrieving files using the FILESRVC file access method?

    • I don't have any best practices to recommend, but am happy to look for more information. Have you run into performance problems or errors when accessing files?

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top